package com.study_platform.controller;


import com.alibaba.fastjson.JSONObject;
import com.study_platform.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author auto
 * @since 2023-04-11
 */
@RestController
@RequestMapping("/study_platform/user")
public class UserController {
    @Resource
    private UserService userService;

    @PostMapping("/account/register/")
    public JSONObject register(@RequestParam Map<String, String> data) {
        return userService.register(data);
    }


    @GetMapping("/account/login/")
    public JSONObject getInfo() {
        return userService.getInfo();
    }


    @PostMapping("/account/login/")
    public JSONObject login(@RequestParam Map<String, String> data) {
        return userService.login(data);
    }

}

